<?php 

namespace FlashMessages\Messages;

use \FlashMessages\FlashMessage;

/**
 * Created by ITokarev
 * 
 * Rendering Blocked Notification
*/

class ItemAction extends \Action
{
	protected static $isPublic = true;
	
	protected static $defaultViews = ['#flashMessages.messages.item'];
	
	static function pullParams() {
		return ['identity'];
	}
	
	function run()
	{
		$id = $this->request->id;
		$flashMessage = FlashMessage::find($id);
		
		if($flashMessage === null)
		{
			throw new \Exception('Flash Message not Found - id:'. $id, 500);
		}
		
		$this->response->flashMessage = $flashMessage;
	}
}
